package com.usian.admin.controller;

import com.usian.admin.service.AdSensitiveService;
import com.usian.apis.admin.AdSensitiveControllerApis;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@Api(value = "敏感词管理",tags = "sensitive", description = "敏感词管理API")
public class AdSensitiveController implements AdSensitiveControllerApis {
    @Autowired
    AdSensitiveService adSensitiveService;
    @Override
    @PostMapping("findAll")
    @ApiOperation(value = "查询敏感词")
    @ApiParam(name = "sensitiveDto",type = "SensitiveDto",required = true)
    public ResponseResult findAll(@RequestBody SensitiveDto sensitiveDto) {
        return adSensitiveService.findAll(sensitiveDto);
    }

    @Override
    @PostMapping("add")
    @ApiOperation(value = "添加敏感词")
    @ApiParam(name = "adSensitive",type = "AdSensitive",required = true)
    public ResponseResult add(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.add(adSensitive);
    }

    @Override
    @GetMapping("del")
    @ApiOperation(value = "删除敏感词",notes = "要删除的id")
    @ApiParam(name = "id",type = "Integer",required = true)
    public ResponseResult del(Integer id) {
        return adSensitiveService.del(id);
    }

    @Override
    @PostMapping("edit")
    @ApiOperation(value = "修改敏感词")
    @ApiParam(name = "adSensitive",type = "AdSensitive",required = true)
    public ResponseResult edit(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.edit(adSensitive);
    }
}
